<?php 
/**
 * Albatross Home Media Streaming Server -- Copyright (c) 2003-2008 Still Designing, LLC
 * Author: David E. Still <stealthdave@stilldesigning.com>
 * Licenced under the GNU General Public License, version 2
 * Name:			index.php
 * Description:	Streams TiVo programs from the TiVo to a
 *					web browser or other web-enabled device
 *					or program through an intermediary server
 *					which reduces the size of the program
 *					stream, which enables the program to be
 *					viewed over slower network connections in
 *					real-time.
 * Created:		12/02/2003
 */
$version = "0.5.1";

/**
 * Set Test Mode
 * $testmode = 0 // normal operation
 * $testmode = 1 // program list from TiVo, but stream a local test file
 * $testmode = 2 // test program list and local test stream
 * $testmode = 3// view streaming command-line (no streaming)
 */
$testmode = 0;
/* Increase timeout setting */
set_time_limit(120);

require_once("albatross.ini.php");

/* Check for Request vars */
$streamopts = "";
$request_vars = Array("action", "fsid", "size", "source", "folder");
foreach ($request_vars as $request_key)
	if(!array_key_exists($request_key,$_REQUEST)) $_REQUEST[$request_key] = "";


$fileExtensionsList = "mov,mpg,mpeg,avi,mp4,flv,ogm,rm,ra,ram,wmv,vob,3gp,dv,asf,mkv,vob,ty,m4v";
$fileExts = explode(",","\.".str_replace(",",",\.",$fileExtensionsList));
$subFolder = urldecode($_REQUEST["folder"]);


/* Load ini file */
if (array_key_exists(urldecode($_REQUEST["source"]), $tySourceList)) $tySource = $tySourceList[urldecode($_REQUEST["source"])];
else $tySource = current($tySourceList);
$isTivo = (substr($tySource,0,4)=="tivo");
$isHMO = (substr($tySource,0,3)=="hmo");
$isMFS = (substr($tySource,0,6)=="mfsftp");
if ($isHMO) {
	preg_match('/tivo:([0-9]{10})@/', $tySource, $mak);
	$mak = $mak[1];
}

$streamopts = key($tyini_streamopts);
reset($tyini_streamopts);
if(array_key_exists($_REQUEST["size"],$tyini_streamopts))
{
	$streamopts = $tyini_streamopts[$_REQUEST["size"]];
	$streamsize = $_REQUEST["size"];
}
else
{
	$streamopts = current($tyini_streamopts);
	$streamsize = key($tyini_streamopts);
}
reset($tyini_streamopts);

/* build streaming link */
$streamlink = "http://".$_SERVER["SERVER_NAME"].":";
$streamlink .= (array_key_exists("stream_port",$tyini))?$tyini["stream_port"]:"8090";
$streamlink .= "/stream.flv";

/* Web Header */
if (!($_REQUEST["action"] == "stream" || $_REQUEST["action"] == "kill")) {
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
	<title>Albatross Home Media Streaming Server</title>
	<!--[if lt IE 7]>
	<style type="text/css">
		body { behavior:url("csshover.htc"); }
	</style>
	<![endif]--> 
	<link rel="stylesheet" type="text/css" href="css/albatross.css" />
	<link rel="stylesheet" type="text/css" href="css/jqModal.css" />
	<script type="text/javascript" src="js/jquery-1.2.2.min.js"></script>
	<script type="text/javascript" src="js/jquery.tablePager.1.0.js"></script>
	<script type="text/javascript" src="js/jqModal.js"></script>
	<script type="text/javascript" src="js/swfobject.js"></script>
	<script type="text/javascript" src="js/albatross.js"></script>
	<script type="text/javascript">
	var albatross = {
		sizes: {
	<?php 
	$comma = "";
	foreach ( $tyini_streamopts as $tykey => $tyopts ) {?>
		<?php echo  $comma ?>"<?php echo  $tykey ?>": { width: "<?php echo  $tyopts["width"] ?>", height: "<?php echo  $tyopts["height"] ?>" }
	<?php 
		$comma = ", ";
	}
	?>
		},
		streamlink: "<?php echo  $streamlink ?>",
		currentSize: "<?php echo  $streamsize ?>",
		currentSource: "<?php echo  $_REQUEST["source"] ?>"
	};
	</script>
</head>
<body>
<div id="player" style="display: none;">
	<!-- Icons curtesy of http://www.ganato.com/free_icons/free_icons.php -->
	<div id="flash"></div>
	<div class="center">
		<span class="buttons">
			<a href="javascript:kill_stream();"><img src="images/stop.png" alt="Halt Stream" title="Halt Stream" /></a>
			<a href="<?php echo  $streamlink ?>"><img src="images/download.png" alt="Stream Link" title="Stream Link" /></a>
			<a href="javascript:load_flash();"><img src="images/reload.png" alt="Reload Flash" title="Reload Flash" /></a>
		</span>
		<span class="title"> </span>
	</div>
</div>
<div id="container">
	<div id="header">
		<a href="http://www.stilldesigning.com/projects/albatross/" style="font-size: 12px;"><img src="images/albatross-logo.png" alt="Albatross" title="Albatross" /></a>
		<h2>Home Media Streaming Server<br />v<?php echo  $version ?></h2>
		<form action="<?php echo  $_SERVER["PHP_SELF"] ?>" id="tystream" method="get">
			<div id="options">
				<label>stream size:</label>
				<select name="size" id="size" onchange="update_size(this);">
<?php foreach ( $tyini_streamopts as $tykey => $tyopts ) {?>
					<option value="<?php echo  urlencode($tykey) ?><?php echo  ($streamsize == $tykey)?"\" selected=\"selected":"" ?>"><?php echo  $tyopts["title"] ?></option>
<?php } ?>
				</select>
				<label>source:</label>
				<select name="source" id="source" onchange="this.form.submit();">
<?php foreach ( $tySourceList as $tykey => $tyopts ) {?>
					<option value="<?php echo  urlencode($tykey) ?><?php echo  (urldecode($_REQUEST["source"]) == $tykey)?"\" selected=\"selected":"" ?>"><?php echo  $tykey ?></option>
<?php } ?>
				</select>
				<a href="javascript:load_player();" title="Load the player manually.  This can be useful if you want to watch a stream already in progress.">load player</a>
			</div>
		</form>
		<?php if ($testmode > 0) {?>
		<div class="testmode">
			<p>
				Albatross is currently running in <b>Test Mode</b>.
				Video streaming may not be enabled in test mode.
			</p>
		</div>
		<?php }?>
	</div>
	<div id="streams">
<?php 
}
	switch ($_REQUEST["action"])
	{
		/* Stream a program */
		case "stream":
			/* create file name string to load */
			$sep = (PHP_OS=="Darwin")?"=":" ";
			$filename = "'".$tySource.$subFolder.$_REQUEST["fsid"]."'";
			if ($testmode > 0 && $testmode < 3) $filename = "'".$tyini["testfile"]."'";
			
			/* build stream command line */
			if(strpos($tyini["vlc"],".exe")) $tyini["vlc"] = "\"".$tyini["vlc"]."\"";
			$stream_cmd = "";
			if ($isTivo) {
				$stream_cmd .= "'".$tyini["vstream-client"]."' ".$tySource.$_REQUEST["fsid"]." -o - | ";
				if ($testmode > 0) $stream_cmd = "cat $filename | ";
				$filename = "stream://-";
			}
			if ($isHMO) {
				$stream_cmd .= $tyini["curl"].' --digest -k -c cookies.txt -u tivo:'.$mak.' "'.str_replace("&amp;", "&", urldecode($_REQUEST["fsid"])).'" | '.$tyini["tivodecode"].' -m '.$mak.' -- - | ';
				if ($testmode > 0) $stream_cmd = "cat $filename | ";
				$filename = "stream://-";
			}
			if ($isMFS) {
				$filename = str_replace("mfsftp://", "ftp://", $tySource)."/ty/".str_replace("&amp;", "&", urldecode($_REQUEST["fsid"])).".ty";
			}
			
			$stream_cmd .= $tyini["vlc"]." -vvv -I http --http-src$sep'"
				.dirname($_SERVER["SCRIPT_FILENAME"])."/controls/' --http-host$sep:8091 "
				.$filename." --sout$sep\"#transcode{";
			if (array_key_exists("samplerate",$streamopts)) { $samplerate = $streamopts["samplerate"]; }
			else { $samplerate = 22050; }
			/* select video format */
			switch ($streamopts["format"]) {
				/* stream h264 video -- for future expansion */
				case "h264":
					$codec = "vcodec=h264,acodec=mp4a";
					$filename = "stream.mp4";
					$mimetype = "video/h264";
					$mux = "mov";
					break;
				/* stream flash video */
				default:
					$codec = "vcodec=FLV1,acodec=mp3";
					$filename = "stream.flv";
					/* samplerate *must* be 44100, 22050, or 11025 for Flash Video */
					$samplerate = (in_array($streamopts["samplerate"], array(44100, 22050, 11025)))?$samplerate:"22050";
					$mimetype = "video/x-flv";
					$mux = "ffmpeg{mux=flv}";
			}
			$stream_cmd .= "$codec,scaletempo,samplerate=$samplerate,audio-sync";
			$stream_cmd .= (array_key_exists("audiobr",$streamopts))?",ab=".$streamopts["audiobr"]:",ab=64";
			$stream_cmd .= (array_key_exists("videobr",$streamopts))?",vb=".$streamopts["videobr"]:",vb=256";
			$stream_cmd .= (array_key_exists("width",$streamopts))?",canvas-width=".$streamopts["width"]:"";
			$stream_cmd .= (array_key_exists("height",$streamopts))?",canvas-height=".$streamopts["height"]:"";
			$stream_cmd .= (array_key_exists("other",$streamopts))?",".$streamopts["other"]:"";
			$stream_cmd .= ",channels=2}:std{access=http{mime=$mimetype},mux=$mux,dst=0.0.0.0:";
			$stream_cmd .= (array_key_exists("streamport",$tyini))?$tyini["streamport"]:"8090";
			$stream_cmd .= "/$filename";
			$stream_cmd .= "}\"";
			$stream_cmd .= ($tyini["use_logging"] > 0)?" --file-logging --logfile$sep".$tyini["log_file"]:"";
			$stream_cmd .= " vlc://quit & ";
			if (array_key_exists("bash",$tyini)) $stream_cmd .= "\"";
			
			$halt_stream = "haltstream.php";
			
			/* test for vlc */
			$vlc_url = "http://"."@".$_SERVER["SERVER_NAME"].":";
			$vlc_url .= (array_key_exists("control_port",$tyini))?$tyini["control_port"]:"8091";
			$vlc_url .= "/halt.html";
			$vlc_control = curl_init($vlc_url);
			curl_setopt ( $vlc_control , CURLOPT_TIMEOUT, 1);
			curl_setopt ( $vlc_control, CURLOPT_USERPWD, trim(file_get_contents("controls/.access")));
			flush();
			$vlc_status = curl_exec($vlc_control);
			curl_close($vlc_control);
			if ($testmode < 3)
			{
				if ($vlc_status != "")
				{
					?><p class="center">A program is currently being streamed from this computer.
					Please wait until it has finished before selecting another stream.
					To continue viewing, <a href="<?php echo  $streamlink ?>">Click&nbsp;here</a>.</p>
					<p class="center">To reload the program listings
					when the program is finished, <a href="">Click&nbsp;here</a>.</p>
					<?php
					exit();
				} else {
				/* Stream program from TiVo to client and resize */
?>streaming started: <a href="<?php echo  $streamlink ?>">link</a><?php 
					if ($testmode > 0) {
						echo "\n\n<br />VLC Command-Line: ".$stream_cmd;
					}
					flush();
				}
			} else {
				echo "\n<br />VLC Command-Line: ".$stream_cmd."\n<br />";
			}
			flush();
			$stream = shell_exec($stream_cmd);
			exit();
			break;
		default:
		/* Pretend to be vstream_client for parsing */
?>
		<table class="listings" border="0" cellpadding="8" cellspacing="0" summary="Program Listings">
		<thead>
		<tr>
			<th class="datetime">Date/Time</th>
			<th>Station</th>
			<th>Program / File Name</th>
			<th>Episode</th>
		</tr>
		</thead>
		<tfoot>
		<tr>
			<td colspan="4" align="center">
				<a href="#" class="pageNext">Next &gt;&gt;</a>
				<a href="#" class="pagePrev">&lt;&lt; Prev</a>
				<div>Page <span class="pageNum"> </span> of <span class="pageCount"> </span></div>
			</td>
		</tr>
		</tfoot>
		<tbody>
<?php 
			/* begin TiVo vserver code */
			if ($isTivo) {
				$fetch_programs_shell = $tyini["vstream-client"] . " ".$tySource."llist 2>&1 ";
				if(array_key_exists("bash",$tyini)) $fetch_programs_shell = $tyini["bash"]." -c \"".$fetch_programs_shell."\"";
				$tivo_list = "";
				if ($testmode >= 2)
					$tivo_list = file_get_contents("testdata/tivo.txt");
				else if (!$vlc_open) $tivo_list = shell_exec($fetch_programs_shell);
				$tivo_list_array = split("\n",str_replace("\n\t"," -- ", $tivo_list));
				$tivo_prog_array = Array();
				foreach ( $tivo_list_array as $prog_data )
				{
					if (substr_count($prog_data, " -- ") == 5)
					{
						$prog_array = explode(" -- ",$prog_data);
						if ($prog_array[0] < 1) $tivo_prog_array[0] = $prog_array;
						else $tivo_prog_array[strtotime($prog_array[1])] = $prog_array;
					}
				}
				arsort($tivo_prog_array);
				reset($tivo_prog_array);
				
				/* Live TV Listing */
				if (array_key_exists(0,$tivo_prog_array))
				{
					$prog_data = $tivo_prog_array[0];
					unset($tivo_prog_array[0]);
	?>
		<tr>
			<td>
				<form action="<?php echo  $_SERVER["PHP_SELF"] ?>" method="get">
				<p class="date">
				<input type="hidden" name="source" value="<?php echo  $_REQUEST["source"] ?>" />
				<input type="hidden" name="size" value="<?php echo  $_REQUEST["size"] ?>" />
				<input type="hidden" name="fsid" value="<?php echo  $prog_data[0] ?>" />
				<input type="hidden" name="progname" value="<?php echo  $prog_data[4] ?><?php echo  ($prog_data[5] != "")?" : ".$prog_data[5]:"" ?>" />
				<input type="hidden" name="action" value="stream" />
				<?php echo  $prog_data[1] ?>
				</p>
				</form>
			</td>
			<td><?php echo  $prog_data[3] ?>&nbsp;</td>
			<td><?php echo  $prog_data[4] ?>&nbsp;</td>
			<td><?php echo  $prog_data[5] ?>&nbsp;</td>
		</tr>
	<?php 
	
				}
				foreach ($tivo_prog_array as $prog_data)
				{
	?>
		<tr>
			<td>
				<form action="<?php echo  $_SERVER["PHP_SELF"] ?>" method="get">
				<p class="date">
				<input type="hidden" name="source" value="<?php echo  $_REQUEST["source"] ?>" />
				<input type="hidden" name="size" value="<?php echo  $_REQUEST["size"] ?>" />
				<input type="hidden" name="fsid" value="<?php echo  $prog_data[0] ?>" />
				<input type="hidden" name="progname" value="<?php echo  $prog_data[4] ?><?php echo  ($prog_data[5] != "")?" : ".$prog_data[5]:"" ?>" />
				<input type="hidden" name="action" value="stream" />
				<?php echo  $prog_data[1] ?>
				</p>
				</form>
			</td>
			<td><?php echo  $prog_data[3] ?>&nbsp;</td>
			<td><?php echo  $prog_data[4] ?>&nbsp;</td>
			<td><?php echo  $prog_data[5] ?>&nbsp;</td>
		</tr>
	<?php 
				}
			/* end TiVo vserver code */
			/* begin TiVo HMO code */
			} else if ($isHMO) {
				include_once("simple_html_dom.php");
				if ($testmode < 1) {
					$hmo_url = str_replace("hmo://tivo:$mak@", "https://", $tySource)."nowplaying/index.html?Recurse=Yes";
					$hmo_listings = curl_init($hmo_url);
					curl_setopt( $hmo_listings, CURLOPT_TIMEOUT, 10 );
					curl_setopt( $hmo_listings, CURLOPT_COOKIEFILE, "cookies.txt" );
					curl_setopt( $hmo_listings, CURLOPT_USERPWD, "tivo:".$mak );
					curl_setopt( $hmo_listings, CURLOPT_SSL_VERIFYPEER, false );
					curl_setopt( $hmo_listings, CURLOPT_SSL_VERIFYHOST, false );
					curl_setopt( $hmo_listings, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST );
					curl_setopt( $hmo_listings, CURLOPT_RETURNTRANSFER, true );
					$listings = curl_exec($hmo_listings);
					if (curl_error($hmo_listings)) {
						echo "<div class='error'><strong>There was a problem retrieving the program list:</strong><br />".curl_error($hmo_listings);
					}
					curl_close($hmo_listings);
					$tivoList = str_get_dom($listings);
				}
				else $tivoList = file_get_dom("testdata/hmo.txt");
				$first = true;
				foreach($tivoList->find("tr") as $program) {
					$cells = $program->find("td");
					if (count($cells) > 0) {
						$progname = $cells[2]->find("b", 0)->innertext;
						$episode = "";
						if (strpos($progname, ': ') > 0) {
							$proginfo = explode(": ", $progname);
							$episode = trim($proginfo[1], "&quot;"); // trim the last double-quote off the end
							$progname = $proginfo[0];
						}
	?>
		<tr>
			<td>
				<form action="<?php echo  $_SERVER["PHP_SELF"] ?>" method="get">
				<p class="date">
				<input type="hidden" name="source" value="<?php echo  $_REQUEST["source"] ?>" />
				<input type="hidden" name="size" value="<?php echo  $_REQUEST["size"] ?>" />
				<input type="hidden" name="fsid" value="<?php echo  urlencode($cells[5]->find('a', 0)->href) ?>" />
				<input type="hidden" name="progname" value="<?php echo  str_replace('"', '\'', $cells[2]->find("b", 0)->innertext) ?>" />
				<input type="hidden" name="action" value="stream" />
				<?php echo  str_replace("<br>", "&nbsp;", $cells[3]->innertext) ?>
					<div class="tooltip" style="display: none;"><?php echo $cells[2]->innertext; ?></div>
				</p>
				</form>
			</td>
			<td><?php echo  $cells[1]->find("img", 0)->alt ?>&nbsp;</td>
			<td><?php echo  $progname ?>&nbsp;</td>
			<td><?php echo  $episode ?>&nbsp;</td>
		</tr>
	<?php 
					}
				}
			/* end TiVo HMO code */
			/* begin TiVo MFS FTP code */
			} else if ($isMFS) {
				if ($testmode < 1) {
					//$listings = shell_exec($tyini["curl"]." ".str_replace("mfsftp://", "ftp://", $tySource)."/ty/");
					$mfs_url = str_replace("mfsftp://", "ftp://", $tySource)."/ty/";
					$mfs_listings = curl_init($mfs_url);
					curl_setopt( $mfs_listings, CURLOPT_TIMEOUT, 10 );
					curl_setopt( $mfs_listings, CURLOPT_RETURNTRANSFER, true );
					$listings = curl_exec($mfs_listings);
					if (curl_error($mfs_listings)) {
						// try fetching listings twice for mfs_ftp due to a bug in mfs_ftp
						$listings = curl_exec($mfs_listings);
						if (curl_error($mfs_listings))
							echo "<div class='error'><strong>There was a problem retrieving the program list:</strong><br />".curl_error($mfs_listings);
					}
					curl_close($mfs_listings);
				}
				else $listings = file_get_contents("testdata/mfs_ftp.txt");
				$first = true;
				foreach(explode("\n", $listings) as $singleListing) {
					$prog = explode("}{", substr(substr($singleListing, 0, strrpos($singleListing, "}")), strpos($singleListing, "{")+1));
	?>
		<tr>
			<td>
				<form action="<?php echo  $_SERVER["PHP_SELF"] ?>" method="get">
				<p class="date">
				<input type="hidden" name="source" value="<?php echo  $_REQUEST["source"] ?>" />
				<input type="hidden" name="size" value="<?php echo  $_REQUEST["size"] ?>" />
				<input type="hidden" name="fsid" value="<?php echo  $prog[5] ?>" />
				<input type="hidden" name="progname" value="<?php echo  str_replace('"', '\'', $prog[0]." - ".$prog[2]); ?>" />
				<input type="hidden" name="action" value="stream" />
				<?php echo  $prog[1] ?>
				</p>
				</form>
			</td>
			<td><?php echo  $prog[4] ?>&nbsp;</td>
			<td><?php echo  $prog[0] ?>&nbsp;</td>
			<td><?php echo  $prog[2] ?>&nbsp;</td>
		</tr>
	<?php 
				}

			/* end TiVo MFS FTP code */
			} else {
				if (!is_dir($tySource)) {?>
	<tr><th>INVALID FOLDER -- Cannot Display File List</th></tr>
<?php 				} else {
				if ($subFolder != "") {
		?>
		<tr>
			<td>&nbsp;</td>
			<td>&nbsp;</td>
			<td>
				<form action="<?php echo  $_SERVER["PHP_SELF"] ?>" method="get">
				<p class="path">Current Folder: /<?php echo  $subFolder ?></p>
				<p>
				<input type="hidden" name="source" value="<?php echo  $_REQUEST["source"] ?>" />
				<input type="hidden" name="size" value="<?php echo  $streamsize ?>" />
				<input type="hidden" name="folder" value="<?php echo  urlencode(substr($subFolder, 0, strrpos("/".substr(urldecode($subFolder), 0, -1), "/") )) ?>" />
				<img src="images/folder.png" alt="Folder" title="Folder" /><a class="folder" href="javascript:void(null)">&uarr; UP</a>
				</p>
				</form>
			</td>
			<td>&nbsp;</td>
		</tr>
<?php 
				}
				$folder = scandir($tySource.$subFolder);
				foreach ($folder as $file) {
					if (is_dir($tySource.$subFolder.$file)) {
						if (substr($file,0,1) != ".") {
			?>
		<tr>
			<td><p class="date"><?php echo  date("m/d/y H:i", filemtime($tySource.$subFolder.$file)) ?></p></td>
			<td>&nbsp;</td>
			<td>
				<form action="<?php echo  $_SERVER["PHP_SELF"] ?>" method="get">
				<p>
				<input type="hidden" name="source" value="<?php echo  $_REQUEST["source"] ?>" />
				<input type="hidden" name="size" value="<?php echo  $streamsize ?>" />
				<input type="hidden" name="folder" value="<?php echo  urlencode($subFolder.$file) ?>/" />
				<img src="images/folder.png" alt="Folder" title="Folder" /><a class="folder" href="javascript:void(null);"><?php echo  $file ?></a>
				</p>
				</form>
			</td>
			<td>&nbsp;</td>
		</tr>
<?php 
						}
					} else {
						foreach ($fileExts as $ext)
							if (preg_match("/".$ext."$/", $file)) {?>
		<tr>
			<td>
				<form method="get" action="<?php echo  $_SERVER["PHP_SELF"] ?>">
				<p class="date">
				<input type="hidden" name="source" value="<?php echo  $_REQUEST["source"] ?>" />
				<input type="hidden" name="size" value="<?php echo  $_REQUEST["size"] ?>" />
				<input type="hidden" name="folder" value="<?php echo  $_REQUEST["folder"] ?>" />
				<input type="hidden" name="fsid" value="<?php echo  $file ?>" />
				<input type="hidden" name="progname" value="<?php echo  $file ?>" />
				<input type="hidden" name="action" value="stream" />
				<?php echo  date("m/d/y H:i", filemtime($tySource.$subFolder.$file)) ?>
				</p>
				</form>
			</td>
			<td>&nbsp;</td>
			<td><?php echo  $file ?></td>
			<td>&nbsp;</td>
		</tr>
<?php 
						}
					}
				}
			}
		}
?>		</tbody>
		</table>
<?php 
	}


/* Web Footer */
if (!($_REQUEST["action"] == "stream" || $_REQUEST["action"] == "kill")) {
?>
	</div>
	<div class="clear"></div>
	<?php 
		if ($testmode >= 0 && $_REQUEST["action"] == "stream") echo "<div class='debug'>vlc command:\n".htmlentities($stream_cmd)."\nstream link: ".htmlentities($streamlink)."\n\n</div>";
	?>
	<div id="footer">
		<div>&copy; 2003-2008 <a href="http://www.stilldesigning.com">Still Designing, LLC</a></div>
		<div>Licenced under the GNU General Public License, version 2</div>
	</div>
</div>
</body>
</html>
<?php 
}
flush();

// EOF

?>
